package bean;


import java.io.Serializable;
import java.util.Date;

import metier.MessageBusiness;

public abstract class MessageBean implements Serializable {

	private static final long serialVersionUID = 1L;
	private int id_message;
	private String contenu;
	private Date date_envoie;
	private int id_eleve_destinataire;
	private int id_eleve_emetteur;
	private MessageBusiness messageBusinessCourant;
	private boolean privacy;
	
	public Date getDate_envoie() {
		return date_envoie;
	}
	public void setDate_envoie(Date date_envoie) {
		this.date_envoie = date_envoie;
	}
	public int getId_message() {
		return id_message;
	}
	public void setId_message(int id_message) {
		this.id_message = id_message;
	}
	public String getContenu() {
		return contenu;
	}
	public void setContenu(String contenu) {
		this.contenu = contenu;
	}
	
	public MessageBean(){
		super();
		messageBusinessCourant = new MessageBusiness();	
	}
	
	public MessageBean(int id_message, String contenu, Date date_envoie) {
		super();
		this.id_message = id_message;
		this.contenu = contenu;
		this.date_envoie = date_envoie;
	}
	public int getId_eleve_destinataire() {
		return id_eleve_destinataire;
	}
	public void setId_eleve_destinataire(int id_eleve_destinataire) {
		this.id_eleve_destinataire = id_eleve_destinataire;
	}
	public int getId_eleve_emetteur() {
		return id_eleve_emetteur;
	}
	public void setId_eleve_emetteur(int id_eleve_emetteur) {
		this.id_eleve_emetteur = id_eleve_emetteur;
	}
	public MessageBusiness getMessageBusinessCourant() {
		return messageBusinessCourant;
	}
	public void setMessageBusinessCourant(MessageBusiness messageBusinessCourant) {
		this.messageBusinessCourant = messageBusinessCourant;
	}
	
	public String ajoutMessage() {
		
		System.out.println(contenu);
		
		if(messageBusinessCourant != null)
			
			messageBusinessCourant.save(this);
		
		return "AjoutMessageOK";
	
	}
	public boolean isPrivacy() {
		return privacy;
	}
	public void setPrivacy(boolean privacy) {
		this.privacy = privacy;
	}
	
}
